﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ImportCensusFiles
{
    class Program
    {
        private static string rootDirectory = "K:\\ftp.census.gov\\geo\\tiger\\TIGER2013\\";
        private static string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=dBase III;";

        static void Main(string[] args)
        {
            
            DirectoryInfo di = new DirectoryInfo(rootDirectory);

            foreach (DirectoryInfo dix in di.GetDirectories())
                ProcessDirectory(dix);
            foreach (FileInfo fix in di.GetFiles())
                ProcessFile(fix);
        }

        private static void ProcessDirectory(DirectoryInfo dix)
        {
            foreach (DirectoryInfo di in dix.GetDirectories())
                ProcessDirectory(di);

            foreach (FileInfo fi in dix.GetFiles())
                ProcessFile(fi);
        }

        private static void ProcessFile(FileInfo fix)
        {
            DirectoryInfo di = fix.Directory;
            string tableName = di.Name;
            using (OleDbConnection dbfConnection = new OleDbConnection(string.Format(connectionString, rootDirectory)))
            {
                dbfConnection.Open();

            }
        }
    }
}
